<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>用户管理</title>
    <script th:src="@{/webjars/jquery/3.4.1/jquery.js}"></script>
    <script th:src="@{/webjars/bootstrap/4.0.0/js/bootstrap.js}"></script>
    <script th:src="@{/js/MUser.js}"></script>
    <link th:href="@{/webjars/bootstrap/4.0.0/css/bootstrap.css}" rel="stylesheet"/>
    <link th:href="@{/css/MUser.css}" rel="stylesheet"/>
</head>
<body>
<div class="container-fluid">

    <h1 class="text-center">用户管理<small><a th:href="@{/mIndex}">后台首页</a></small></h1>

    <div id="selectUsers" class="row form-inline">
        <div class="form-group col-md-3 col-sm-12 col-12 row">
            <input type="text" class="form-control" id="userNumber" placeholder="请输入用户账号">
        </div>
        <div class="form-group col-md-3 col-sm-12 col-12 row">
            <input type="text" class="form-control" id="userName" placeholder="请输入用户名">
        </div>
        <div class="form-group col-md-3 col-sm-12 col-12 row">
            <select id="registerState" class="form-control">
                <option></option>
                <option th:each="registerState:${registerStates}">[[${registerState}]]</option>
            </select>
        </div>
        <div class="col-md-3 col-sm-12 col-12 row">
            <button id="selectUser" class="btn">查询</button>
        </div>
    </div>

    <div>
        <table id="resourceTable" class="table table-bordered table-hover text-center">
            <tr style="background-color:lightgray;">
                <td>用户编号</td>
                <td>用户账号</td>
                <td>用户名</td>
                <td>用户注册状态</td>
                <td>操作</td>
            </tr>
            <tr class="resourceList" th:each="pages,userStat:${page}">
                <td>[[${userStat.index}]]</td>
                <td>[[${pages.userNumber}]]</td>
                <td>[[${pages.userName}]]</td>
                <td>[[${pages.registerState}]]</td>
                <td th:alt="${pages.userNumber}">
                    <a class="add" th:if="${pages.registerState=='注册中'}">允许注册</a>
                    <a class="prohibit" th:if="${pages.registerState!='管理员'&&pages.registerState!='账号已禁用'}">禁用</a>
                    <a class="prohibit" th:if="${pages.registerState!='管理员'&&pages.registerState=='账号已禁用'}">解除禁用</a>
                    <a class="delete" th:if="${pages.registerState!='管理员'}">删除</a>
                    <span style="color: red;" th:if="${pages.registerState=='管理员'}">管理员无权限删除管理员</span>
                </td>
            </tr>
        </table>
    </div>
    <div class="col-md-6 offset-md-3 col-sm-8 offset-sm-2 col-12">
        <div id="paging" class="text-center">
            <a th:if="${pageNumber>0}" id="PreviousPage">上一页</a>
            第<span id="NowPage">[[${pageNumber}]]</span><span>/</span><span>[[${pageNumbers}]]</span>页
            <a th:if="${pageNumber<pageNumbers}" id="NextPage">下一页</a>
        </div>
    </div>
    <div th:replace="Login::foot"></div>
</div>
</body>
</html>